import { baseUrl } from '../config/index'

export const $request = (params) => {
  wx.showLoading({
    title: '加载中',
  })
  return new Promise((resolve, reject) => {
      wx.request({
        url: baseUrl + params.url ,
        method: 'GET',
        success: res => {
          // console.log(res.data.data)
          resolve(res.data)
        },
        fail: err => {
          reject(err)
        },
        complete: () => {
          wx.stopPullDownRefresh(),
            wx.hideLoading()
        }
      })
    

  })


}